import * as koaStaticCache from "koa-static-cache"
import { routes } from "./router"

import * as bodyparser from "koa-bodyparser"
import * as Koa from 'koa';              // 导入koa
import "./ws/readyGame";
// 使用koa-log4作为日志管理
import { logger, accessLogger } from './utils/log4j';

// 新建一个Koa对象
import * as Router from "koa-router"
import { KOA_STATIC_CACHE_PATH } from "./config/const"
const cors = require('koa2-cors');
const app = new Koa()
const router: Router = new Router()



app.use(koaStaticCache(KOA_STATIC_CACHE_PATH))

app.use(cors());
app.use(accessLogger());


app.use(bodyparser({
    enableTypes: ['json', 'form', 'text', 'file'],

}))





router.get("/uu", ctx => {
    ctx.body = "22"
})
app.use(routes.routes())
app.use(routes.allowedMethods())










const port = "9999"


app.listen("9999", () => {
    console.log(`Server running at http://47.93.221.158:9999`);

})






